
#ifndef __LED_H__
#define __LED_H__

#include <stdint.h>
#include "rtdef.h"

#define BOARD_LED_RED       (1 << 0)
#define BOARD_LED_GREEN     (1 << 1)
#define BOARD_LED_BLUE      (1 << 2)
#define BOARD_LED_ALL       (BOARD_LED_RED | BOARD_LED_GREEN | BOARD_LED_BLUE)

typedef enum {
    LED_OP_OFF,
    LED_OP_ON,
    LED_OP_TOGGLE
} led_op_t;

void hw_led_init(void);
void hw_led_set(uint32_t leds, led_op_t op);

#define RT_KEY0      ((rt_uint32_t)(1<<0))
#define RT_KEY1      ((rt_uint32_t)(1<<1))
#define RT_KEY2      ((rt_uint32_t)(1<<2))
#define RT_KEY3      ((rt_uint32_t)(1<<3))
#define RT_KEY4      ((rt_uint32_t)(1<<4))
#define RT_KEY5      ((rt_uint32_t)(1<<5))
#define RT_KEY6      ((rt_uint32_t)(1<<6))
#define RT_KEY7      ((rt_uint32_t)(1<<7))
#define RT_KEY8      ((rt_uint32_t)(1<<8))
#define RT_KEY9      ((rt_uint32_t)(1<<9))
#define RT_KEY10     ((rt_uint32_t)(1<<10))
#define RT_KEY11     ((rt_uint32_t)(1<<11))
#define RT_KEY12     ((rt_uint32_t)(1<<12))
#define RT_KEY13     ((rt_uint32_t)(1<<13))
#define RT_KEY14     ((rt_uint32_t)(1<<14))
#define RT_KEY15     ((rt_uint32_t)(1<<15))
#define RT_KEY16     ((rt_uint32_t)(1<<16))
#define RT_KEY17     ((rt_uint32_t)(1<<17))
#define RT_KEY18     ((rt_uint32_t)(1<<18))
#define RT_KEY19     ((rt_uint32_t)(1<<19))
#define RT_KEY20     ((rt_uint32_t)(1<<20))
#define RT_KEY21     ((rt_uint32_t)(1<<21))
#define RT_KEY22     ((rt_uint32_t)(1<<22))
#define RT_KEY23     ((rt_uint32_t)(1<<23))
#define RT_KEY24     ((rt_uint32_t)(1<<24))
#define RT_KEY25     ((rt_uint32_t)(1<<25))
#define RT_KEY26     ((rt_uint32_t)(1<<26))
#define RT_KEY27     ((rt_uint32_t)(1<<27))
#define RT_KEY28     ((rt_uint32_t)(1<<28))
#define RT_KEY29     ((rt_uint32_t)(1<<29))
#define RT_KEY30     ((rt_uint32_t)(1<<30))
#define RT_KEY31     ((rt_uint32_t)(1<<31))
#define RT_KEYALL    ((rt_uint32_t)-1)

void rt_key_init(void);
void rt_key_enable(void);
void rt_key_disable(void);
rt_uint32_t rt_key_get_press(void);
rt_uint32_t rt_key_get_down(rt_uint32_t keys);
rt_uint32_t rt_key_get_up(rt_uint32_t keys);
rt_err_t rt_key_wait(rt_int32_t tick);

#endif /* __LED_H__ */

